package com.heima.wemedia.controller;

import com.heima.model.media.dtos.WmUserSaveDTO;
import com.heima.wemedia.service.WmUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Fuqiang
 * @since :2023-03-24
 */
@Slf4j
@RestController
@RequestMapping("/api/v1/wmuser")
public class WmUserController {

    @Autowired
    private WmUserService wmUserService;

    /**
     * 保存自媒体用户 feign调用
     *
     * @param dto
     * @return 自媒体用户id
     */
    @PostMapping("/save")
    public Integer save(@Validated @RequestBody WmUserSaveDTO dto) {

        return this.wmUserService.createWmUser(dto);
    }
}
